home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Creative Review 28
/
Creative-Review-CD-ROM-28.iso
/
pc
/
kungfu
/
assets
/
game.dir
/
00016_Script_back class
< prev
next >
Wrap
Text File
|
1997-08-08
|
5KB
|
232 lines
-- back class
-- ==================================================
property old
property new
property centrestage
property offstageright
property offstageleft
property shapeoffset
property shaperect
property stepvector
property props
property animflag
property callbackcount
global ggame, gtime, gplayer, gboss, gsound
-- ==================================================
-- new method
-- --------------------------------------------------
on new me
minit me
return me
end new
-- ==================================================
-- minit method
-- --------------------------------------------------
on minit me
-- put "in minit back"
set backlist = []
set backchannels = [ 1, 2 ]
set backprops = [:]
setaprop backprops, #castname, "keys"
repeat with channel in backchannels
setaprop backprops, #channel, channel
set back = new ( script "move class" , backprops )
add backlist , back
end repeat
set old = getat ( backlist, 1 )
set new = getat ( backlist, 2 )
set screen = point ( 640, 0 )
set centrestage = point ( 320, 235 )
set offstageright = centrestage + screen
set offstageleft = centrestage - screen
set shapeoffset = point ( - 320, - 70 )
set shaperect = rect(0, 0, 640, 240) - 1000
set stepvector = point ( - 17, 0 )
set animflag = false
-- put "out minit back"
end minit
-- ==================================================
-- msplat method
-- --------------------------------------------------
on msplat me, backcast
put "in msplat back class :" , backcast
msetcastname new , backcast
mcheckshape me, backcast
mdraw new
put "out msplat back class "
end msplat
-- ==================================================
-- mcheckshape method
-- --------------------------------------------------
on mcheckshape me, newcast
-- put "in mcheckshape back class "
if the type of member newcast = #shape then
-- put "shape"
msetrect new , shaperect
msetoffset new , shapeoffset
else
-- put "bitmap"
msetoffset new , point ( 0, 0 )
msetrect new , the rect of cast newcast
end if
-- put "out mcheckshape back class "
end mcheckshape
-- ==================================================
-- mslide method
-- --------------------------------------------------
on mslide me, newbackcast
-- put "in mslide back class :"
set animflag = true
set callbackcount = 0
set recycle = old
set old = new
set new = recycle
msetcastname new, newbackcast
mcheckshape me, newbackcast
set props = [:]
setaprop props, #callback, me
setaprop props, #targetloc, centrestage
setaprop props, #startloc, offstageright
mstartmove new, props
setaprop props, #targetloc, offstageleft
setaprop props, #startloc, centrestage
setaprop props, #stepvector, stepvector
mstartmove old, props
-- maddtask gtime, me, the timer
mdotask me
-- put "out mslide back class :"
end mslide
-- ==================================================
-- mslide method
-- --------------------------------------------------
on mfinish me
unloadmember the castname of old
msetcastnumber old, 0
mdraw old
updatestage
set animflag = false
mdeletetasks gtime, me
mfinishslide ggame
-- mshow gtime
end mfinish
-- ==================================================
-- mdotask method
-- --------------------------------------------------
on mdotask me
-- put "in mdotask back class :"
-- put "oldtype: " , the oldtype of ggame
repeat while true
mdotask new
mdotask old
if the oldtype of ggame = #boss then
mmove gboss, stepvector
mmove gplayer, stepvector
mdraw gboss
mdraw gplayer
else if the oldtype of ggame = #baddy then
mmove gplayer, stepvector
mdraw gplayer
end if
updatestage
if not animflag then exit repeat
end repeat
return false
put "out mdotask back class :"
end mdotask
-- ==================================================
-- mcallback method
-- --------------------------------------------------
on mcallback me
-- put "in mcallback back"
set callbackcount = callbackcount + 1
if callbackcount = 2 then
mfinish me
end if
-- put "out mcallback back"
end mcallback
-- ==================================================
-- mshow method
-- --------------------------------------------------
on mshow me
put "in mshow back class :"
puto me
putl backlist
put "out mshow back class :"
end mshow